##############################################		
###need complete cases so subset below		

###reduced version
use.formula = as.formula(paste('public.ingroup.preference ~ ',master.formula,sep = ''))
use.formula.reduced = as.formula(paste('public.ingroup.preference ~ ',master.formula.reduced,sep = ''))

use.vars = c('public.ingroup.preference',master.use.vars)


################################################

use.dat.uo = dat.uo[,use.vars]
use.dat.uo = dat.uo[dat.uo$index.city != city ,use.vars]
use.dat.uo = use.dat.uo[complete.cases(use.dat.uo),]

reg.uo.pub.reduced = lm(use.formula.reduced, data = use.dat.uo)
clustered.se = cl(use.dat.uo, reg.uo.pub.reduced, use.dat.uo$index.city)
reg.uo.pub.reduced$se = clustered.se

reg.uo.pub = lm(use.formula, data = use.dat.uo)
clustered.se = cl(use.dat.uo, reg.uo.pub, use.dat.uo$index.city)
reg.uo.pub$se = clustered.se

##############
use.dat.sec = dat.non.uo[,use.vars]
use.dat.sec = dat.non.uo[dat.non.uo$index.city != city ,use.vars]
use.dat.sec = use.dat.sec[complete.cases(use.dat.sec),]

reg.sec.pub.reduced = lm(use.formula.reduced, data = use.dat.sec)
clustered.se = cl(use.dat.sec, reg.sec.pub.reduced, use.dat.sec$index.city)
reg.sec.pub.reduced$se = clustered.se

reg.sec.pub = lm(use.formula, data = use.dat.sec)
clustered.se = cl(use.dat.sec, reg.sec.pub, use.dat.sec$index.city)
reg.sec.pub$se = clustered.se

